﻿// --------------------------------------------------------------------------------------------------------------------- 
// <copyright file="ServiceException.cs" company="Scrum for Team System">
//   None
// </copyright>
// <summary>
//   Defines the ServiceException type.
// </summary>
// ---------------------------------------------------------------------------------------------------------------------

namespace ScrumForTeamSystem.EventService.Infrastructure
{
    using System;
    using System.Runtime.Serialization;

    /// <summary>
    /// Defines the ServiceException type.
    /// </summary>
    [Serializable]
    public class ServiceException : Exception
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceException"/> class.
        /// </summary>
        /// <param name="serviceName">Name of the service.</param>
        public ServiceException(string serviceName)
        {
            this.ServiceName = serviceName;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceException"/> class.
        /// </summary>
        /// <param name="serviceName">Name of the service.</param>
        /// <param name="message">The message.</param>
        public ServiceException(string serviceName, string message) : base(message)
        {
            this.ServiceName = serviceName;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceException"/> class.
        /// </summary>
        /// <param name="serviceName">Name of the service.</param>
        /// <param name="message">The message.</param>
        /// <param name="exception">The exception.</param>
        public ServiceException(string serviceName, string message, Exception exception)
            : base(message, exception)
        {
            this.ServiceName = serviceName;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceException"/> class.
        /// </summary>
        public ServiceException()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceException"/> class.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="innerException">The inner exception.</param>
        public ServiceException(string message, Exception innerException) : base(message, innerException)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceException"/> class.
        /// </summary>
        /// <param name="serializationInfo">The serialization info.</param>
        /// <param name="streamingContext">The streaming context.</param>
        protected ServiceException(SerializationInfo serializationInfo, StreamingContext streamingContext)
            : base(serializationInfo, streamingContext)
        {
        }

        /// <summary>
        /// Gets or sets the name of the service.
        /// </summary>
        /// <value>The name of the service.</value>
        public string ServiceName
        {
            get;
            set;
        }

        /// <summary>
        /// Gets the object data.
        /// </summary>
        /// <param name="serializationInfo">The serialization info.</param>
        /// <param name="streamingContext">The streaming context.</param>
        public new virtual void GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext)
        {
            base.GetObjectData(serializationInfo, streamingContext);
        }
    }
}